package com.yuanian.timingwheel.dao;

import com.yuanian.timingwheel.respository.po.LivingServerEntity;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

@Repository
public interface LivingServerDao {

    @Select("select id as id, server_ip as serverIp, last_respond_time as lastRespondTime, delay_cnt as delayCnt from TP_TW_LIVINGSERVER")
    LivingServerEntity getLivingServer();

    @Delete("delete from TP_TW_LIVINGSERVER")
    void deleteLivingServer();

    @Insert("insert into TP_TW_LIVINGSERVER(server_ip, last_respond_time, delay_cnt) values(#{serverIp}, #{lastRespondTime}, #{delayCnt})")
    void insertLivingServer(LivingServerEntity livingServerEntity);

}
